package Controller.Hadoop;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Bean.MemberBean;
import Bean.areaGGLBean;
import Bean.areaGSLBean;
import Bean.arealikeBean;
import Bean.monthGLBean;
import Bean.musicALBean;
import Bean.musicGLBean;
import Bean.singerALBean;
import Dao.adminDao;

public class hadoopPut implements Controller {
	private adminDao dao;
	private singerALBean bean = new singerALBean();

	public void setDao(adminDao dao) {
		this.dao = dao;
	}

	@SuppressWarnings("null")
	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse arg1) throws Exception {
		HttpSession session = request.getSession();

		String[] cmd = { "hadoop fs -rm /bigmusic.csv",
				"hadoop fs -put /home/hadoop/Lab/bigmusic.csv /bigmusic.csv",
				"rm /home/hadoop/Lab/bigmusic.csv",
				"touch /home/hadoop/Lab/bigmusic.csv"};

		System.out.println("하둡 연결");
		hadoopConect hadoop = new hadoopConect();
		System.out.println("리눅스 쓰기");
		// System.out.println(command.get(selectCom)+"하둡 명령어");
		System.out.println(cmd);
		List<String> ret = hadoop.execs(cmd);

		System.out.println("쓰기 끝 ");

		ModelAndView mav = new ModelAndView();
		mav.setViewName("hadoop");
		return mav;
	}
}
